package com.BraveY.Demo09;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo1 {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();

        Student s1 = new Student(001,"胖鸡",18);
        Student s2 = new Student(002,"胖鸡1",18);
        Student s3 = new Student(003,"胖鸡2",19);

        list.add(s1);
        list.add(s2);
        list.add(s3);
        Iterator<Student> it = list.iterator();

        while (it.hasNext()){
            Student stu = it.next();
            System.out.println(stu);
        }

        for (Student stu:list){
            System.out.println(stu);
        }



    }
}
